MPWaitOnSemaphore

Waits on a semaphore

OSStatus MPWaitOnSemaphore (
                     MPSemaphoreID semaphore,
                     Duration timeout);
semaphore
A value of type MPSemaphoreID that specifies the ID of the semaphore you want to wait on.

timeout
A value of type Duration that specifies the maximum time the function should wait before timing out. See Timer Duration Constants for a list of constants you can use to specify the wait interval.

function result
A result code. See Result Codes for a list of possible values.
DISCUSSION
If the value of the semaphore is greater than zero, the value is decremented and the function returns with noErr . Otherwise, the task is blocked awaiting a signal until the specified timeout is exceeded.

If you call this function from a cooperative task, you should specify only kDurationImmediate for the timeout length; other waits will cause the task to block.

VERSION NOTES
Introduced with Multiprocessing Services 1.0.

SEE ALSO
The function MPSignalSemaphore .


© 1999 Apple Computer, Inc. – (Last Updated 17 Nov 99)